package com.eaoa.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.eaoa.vo.pub.PubAccount;
import com.stony.core.bo.HibernateBusinessObject;
import com.stony.core.exception.HttpSessionException;
import com.stony.core.struts.action.AjaxAction;

public abstract class EABaseAjaxAction extends AjaxAction {

	protected PubAccount getEmployee(HttpServletRequest request) {

		return (PubAccount) request.getSession().getAttribute("Employee");

	}

	public void doAjax(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		if (getEmployee(request) == null)
			throw new HttpSessionException();

		HibernateBusinessObject.EMPLOYEE.set(getEmployee(request));

	}

	public abstract String getXmlContent(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception;
}
